// 在 search_job.js 中导入 recommend_list
import recommend_list from '../store/recommend_list.js';

export function search_job() {
    var userEmail = localStorage.getItem('userEmail'); // 获取登录用户邮箱

    fetch('http://127.0.0.1:8000/search_job', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
        },
        body: 'user_email=' + userEmail,
    })
        .then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok');
            }
            return response.json();
        })
        .then(data => {
            console.log(data);
            recommend_list.value = data.result;
        })
        .catch(error => {
            console.error('Error:', error);
        });
}
